package com.bgds.sys.task;

import cn.hutool.core.util.HexUtil;
import com.bgds.sys.socket.CombustionFanFactory;
import com.bgds.sys.socket.SocketClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 助燃风机采集速度
 *
 * @author chenchao
 * @date 2021/10/29
 */
@Component
@Slf4j
public class CombustionFanJob {
    @Resource
    private SocketClient socketClient;

    @Resource
    private CombustionFanFactory combustionFanFactory;

    @Scheduled(fixedDelay = 1000 * 60)
    public void collectSpeedDataOfCombustionAirBlower() {
        byte[] bytes = combustionFanFactory.getDetongRestApiData();
        System.out.println(HexUtil.encodeHexStr(bytes));
        log.info("助燃风机socket电文:length={}", bytes.length);
        socketClient.sendMessage(bytes);
    }


}
